home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / Interfaces&Libraries / Interfaces / CIncludes / time.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-17  |  2.1 KB  |  94 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3.     Time.h
  4.     Date and time
  5.     
  6.     Copyright © Apple Computer,Inc.  1987-1991, 1993, 1994.
  7.     All Rights Reserved.
  8.  
  9. ************************************************************/
  10.  
  11.  
  12. #ifndef __TIME_H__ /* __TIME__ is a reserved preprocessor symbol */
  13. #define __TIME_H__
  14.  
  15.  
  16. /*
  17.  * Get common declarations 
  18.  */
  19.  
  20. #include <NullDef.h>
  21. #include <SizeTDef.h>
  22.  
  23. /*
  24.  *    Declarations
  25.  */
  26.  
  27. #define CLOCKS_PER_SEC 60
  28. typedef unsigned long int clock_t;
  29. typedef unsigned long int time_t;
  30. #ifdef powerc
  31. #pragma options align=power
  32. #endif
  33. struct tm {
  34.     int tm_sec;        /* Seconds after the minute -- [0, 61] */
  35.     int tm_min;        /* Minutes after the hour -- [0, 59] */
  36.     int tm_hour;    /* Hours after midnight -- [0, 23] */
  37.     int tm_mday;    /* Day of the month -- [1, 31] */
  38.     int tm_mon;        /* Months since January -- [0, 11] */
  39.     int tm_year;    /* Years since 1900 */
  40.     int tm_wday;    /* Days since Sunday -- [0, 6] */
  41.     int tm_yday;    /* Days since January 1 -- [0, 365] */
  42.     int tm_isdst;    /* Daylight Savings Time flag */
  43. };
  44. #ifdef powerc
  45. #pragma options align=reset
  46. #endif
  47.  
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51.  
  52. #if defined (__powerc) || defined (powerc) || defined (__CFM68K__)
  53.     #pragma import on
  54. #endif
  55.  
  56. /*
  57.  *    Time manipulation functions
  58.  */
  59.  
  60. clock_t clock(void);                        /* function */
  61. #if !defined (__powerc) && !defined (powerc) && !defined (__CFM68K__)
  62.     #define clock() __tickcount()            /* macro - use TickCount() */
  63.     pascal unsigned long __tickcount(void)
  64.         = 0xA975; 
  65. #endif /* powerc */
  66.  
  67. double  difftime(time_t time1, time_t time0);                /* function */
  68. #define difftime(time1,time0) ((long double)time1 - time0)    /* macro */
  69.  
  70. time_t mktime(struct tm *timeptr);
  71. time_t time(time_t *timer);
  72.  
  73.  
  74. /*
  75.  *    Time conversion functions
  76.  */
  77.  
  78. char *asctime (const struct tm *timeptr);
  79. char *ctime(const time_t *timer);
  80. struct tm *gmtime(const time_t *timer);
  81. struct tm *localtime(const time_t *timer);
  82. size_t strftime(char *s, size_t maxsize,
  83.                  const char *format, const struct tm *timerptr);
  84.  
  85. #if defined (__powerc) || defined (powerc) || defined (__CFM68K__)
  86.     #pragma import off
  87. #endif
  88.  
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92.  
  93. #endif
  94.